package rsexplorer.utils;

import java.lang.reflect.Field;
import java.util.Iterator;

public class FieldsIterator implements Iterator<Field[]> {

    private Class<?> cls;

    public FieldsIterator(Class<?> cls) {
        this.cls = cls;
    }

    public boolean hasNext() {
        return !cls.getName().equals("java.lang.Object");
    }

    public Field[] next() {
        Field[] fields = cls.getDeclaredFields();
        cls = cls.getSuperclass();
        return fields;
    }

    public void remove() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
